package com.zyong.design.pattern.visitor.case3;

/**
 * 具体的数据操作
 * @program: zyong-design-pattern
 * @ClassName: AreaCalculator
 * @author: zyong
 * @create: 2024-03-30 01:08
 */
public class AreaCalculator implements Visitor {

    @Override
    public void visit(Circle circle) {
        double area = Math.PI * circle.getRadius() * circle.getRadius();
        System.out.println("Area of Circle: " + area);
    }

    @Override
    public void visit(Rectangle rectangle) {
        double area = rectangle.getWidth() * rectangle.getHeight();
        System.out.println("Area of Rectangle: " + area);
    }
}
